package com.harveyspace.aes.social.battlenet;

/**
 * URL
 *
 * @Author <a href="harveyer@163.com">harvey</a>
 * @date 2018/2/9
 */
public enum URLEnum {

    US("us", "https://us.battle.net", "https://us.api.battle.net"),
    EU("eu", "https://eu.battle.net", "https://eu.api.battle.net"),
    KR("kr", "https://kr.battle.net", "https://kr.api.battle.net"),
    CN("cn", "https://www.battlenet.com.cn", "https://www.battlenet.com.cn");

    private String name;

    private String globalUrl;

    private String apiUrl;

    URLEnum(String name, String globalUrl, String apiUrl) {
        this.name = name;
        this.globalUrl = globalUrl;
        this.apiUrl = apiUrl;
    }

    public String getName() {
        return name;
    }

    public String getGlobalUrl() {
        return globalUrl;
    }

    public String getApiUrl() {
        return apiUrl;
    }

    public static URLEnum get(String name) {

        if (null != name) {
            for (URLEnum urlEnum : URLEnum.values()) {
                if (name.equals(urlEnum.getName())) {
                    return urlEnum;
                }
            }
        }

        return URLEnum.CN;
    }
}
